<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@page import="com.hnas.core.util.PropertyUtil"%>
<%@page import="com.hnas.core.dto.DataBean"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>订单信息</title>
<script type="text/javascript">
</script>
</head>
<body>
	<!-- 标题 -->
	<div class="titleBar m_b_20">
		<div class="tit fl b_l_e74a5f">
			<h3 class="cn">订单信息</h3>
			<span class="en">card information</span>
		</div>
		<div class="fr"></div>
	</div>
	<!-- end 标题 -->

	<form method="post" action="${pageContext.request.contextPath }/backend/order/search" name="searchForm"  >
  	<input type="hidden" name="pageNo" value="${dto.pageNo}">
  	<input type="hidden" name="totalCount" value="${dto.totalCount}">
	<!-- 查询 -->
	<div class="box_03 p_20 m_b_20">
		<table class="tb_style02" width="100%">
	       <tr>
               	<th>订单编号</th>
               	<td><input name="orderNo" value="${dto.orderNo}" style="width:200px;" class="input_style2" type="text" placeholder=""></td>
               	<th>订单状态</th>
               	<td style="width:130px;">
               		<select style="width:130px;height:35px; line-height:35px;" name="orderStatus" class="input_style2">
						<option value="">--请选择--</option>
						<c:forEach items="${orderStatusMap }" var="v">
					        <option value="${v.key }" <c:if test="${v.key == dto.orderStatus}">selected="selected"</c:if>>${v.value }</option>
				       </c:forEach>
					</select>
	            </td>
	            <%-- <th>订单类型</th>
               	<td style="width:130px;">
               		<select style="width:130px;height:35px; line-height:35px;" name="orderType" class="input_style2">
						<option value="">--请选择--</option>
						<c:forEach items="${orderTypeMap }" var="v">
					        <option value="${v.key }" <c:if test="${v.key == dto.orderType}">selected="selected"</c:if>>${v.value }</option>
				       </c:forEach>
					</select>
	            </td> --%>
                <th>卡号</th>
               	<td style="width:130px;"><input name="cardNo" value="${dto.cardNo }" style="width:200px;" class="input_style2" type="text" placeholder=""></td>
	        	<th>交易流水号</th>
               	<td style="width:130px;"><input name="swiftNumber" value="${dto.swiftNumber }" style="width:200px;" class="input_style2" type="text" placeholder=""></td>
            </tr>
	        <tr>
	        	<th style="width:130px;">开始时间</th>
               	<td>
               		<input type="text" style="width:130px;" name="startDate" id="startDate" value="${dto.startDate}" style="width:100px;" class="input_style2"/>
                </td>
                <th style="width:130px;">结束时间</th>
               	<td>
               		<input type="text" style="width:130px;" name="endDate" id="endDate" value="${dto.endDate}" style="width:100px;" class="input_style2"/>
                </td>
                <th style="width:130px;">每页显示</th>
               	<td>
               		<input type="text" style="width:30px;" name="pageSize" id="pageSize" value="${dto.pageSize}" style="width:100px;" class="input_style2"/>
                </td>
                
                <th style="width:130px;"></th>
               	<td>
               		<input style="width:110px;" class="btn_brown02 m_r_12" type="button" name="searchData" id="searchData" value="查  询">
                </td>
	         </tr>
		</table>
	</div> 
	<!-- end 查询 -->
				
</form>

<div class="m_b_20">
	<table class="tb_style05" width="100%" style="table-layout:fixed;">
		<thead>
		<tr>
			<c:forEach items="${beans}" var="o">
			<c:if test="${o.display && !o.hidden}"><th>${o.title}</th></c:if>
			</c:forEach>
			<th width="100">操作</th> 
		</tr>
		</thead>
		<tbody>
			<c:forEach items="${pg.list}" var="o">
			<tr>
				<c:forEach items="${beans}" var="o1">
					<c:if test="${o1.display && !o1.hidden}">
					<td style="word-wrap:break-word;"><%=String.valueOf(PropertyUtil.getValue(pageContext.getAttribute("o"),((DataBean)pageContext.getAttribute("o1")).getField())).replace("false","否").replace("true","是")%></td></c:if>
				
				</c:forEach>
				<td>
					<a href="#" class="c_3366cc btn editData" orderNo="${o.orderNo }">
					        查看
					</a>
					<a href="#" class="c_3366cc btn editDataDetail" orderNo="${o.orderNo }" orderType="${o.orderType }" >
					        详情
					</a>
				</td>
			</tr>
			</c:forEach>
		</tbody>
	</table>
	<div class="searpage" align="right"><div>${pg.pageStr}</div></div><br/>
	<div class="editDataDiv" id="editDIV" title="${pageTitle}" style="display: none;" >
		<form action="#" id="editFm" method="post" name="editFm" class="editFm" ><input type="hidden" name="id" id="dealid" value=0>
			<table >
				<c:forEach items="${beans}" var="o">
					<c:choose>
						<c:when test="${o.hidden}">
							<input type="hidden" name="${o.field}" id="deal${o.fieldId}" value="0">
						</c:when>
						<c:otherwise>
							<tr>
								<td width="26%" align="right"> 
									<label>${o.title}：</label>  
								</td>
								<c:if test="${o.tagType == 0}">
									<td> 
										<input type="text" name="${o.field}" id="deal${o.fieldId}" style="width:${o.length gt 0?o.length:200}px" <c:if test="${o.maxlength>0}">maxlength="${o.maxlength}"</c:if> <c:if test="${true == o.readonly}">readonly="readonly"</c:if>/>
										<c:if test="${not empty o.hint}">（${o.hint}）</c:if>
										<c:if test="${empty o.hint && o.dataType=='boolean'}">（1--是；0--否）</c:if>
										<c:if test="${!o.nullable}"><font color="red">*</font></c:if>
									</td>
								</c:if>
								<c:if test="${o.tagType == 1}">
									<td>
										<textarea name="${o.field}" id="deal${o.fieldId}" rows="3" style="width:${o.length gt 0?o.length:200}px" <c:if test="${o.maxlength>0}">maxlength="${o.maxlength}"</c:if> <c:if test="${true == o.readonly}">readonly="readonly"</c:if>></textarea>
										<c:if test="${not empty o.hint}">（${o.hint}）</c:if>
										<c:if test="${empty o.hint && o.dataType=='boolean'}">（1--是；0--否）</c:if>
										<c:if test="${!o.nullable}"><font color="red">*</font></c:if>
									</td>
								</c:if>
							</tr>
						</c:otherwise>
					</c:choose>
				</c:forEach>
				<tr>
	      			<td colspan="2">
	          			<p class="validateTips_deal" align="center"></p>
	      			</td>
	    		</tr>
			</table>
		</form>
	</div>
	
	
	
</div>
<%-- <script type="text/javascript" src="${pageContext.request.contextPath }/static/js/jquery.timepicker.js"></script> --%>
<script>
	function gotoJumpPage(){
		var jumpNum= $("#jumpNum").val();
		$("#search_page_size").val($("#id_page_size").val());
		gotoPage(jumpNum);
		return false;
	}
	$(function(){
		$("#searchData").click(function(){
			/** 校验输入页数是否非法  **/
			var pageSize=$("#pageSize").val();
			var reg = new RegExp("^[0-9]*$");
			if($.trim(pageSize)!=""){
				if(!reg.test($.trim(pageSize))){
					alert("每页显示数请输入非负整数");
	 				return false;
				}
			}
			if($.trim(pageSize)==""){
				alert("每页显示数不应许为空");
				return false;
			}
			doSubmit();
		});
		
	});
	
	$("#startDate").datepicker({
		dateFormat:'yy-mm-dd',
		changeYear: true,
		changeMonth: true,
		yearRange: "1900:2049" 
	});
	
	$("#endDate").datepicker({
		dateFormat:'yy-mm-dd',
		changeYear: true,
		changeMonth: true,
		yearRange: "1900:2049" 
	});	
	
	//锁定
	$(".disableData").click(function(){
		var id = $(this).attr("id");
		var valid = $(this).attr("data");
		$.ajax({
			url:"${pageContext.request.contextPath}/backend/account/updateAccount?id="+id+"&valid="+valid,
			type: 'POST',
			error: function(XMLHttpRequest, textStatus, errorThrown){
				 $.dialog.alert({title:"更新",content:"更新状态异常..."});
			},
			success: function(data){
				if("1" == data){
				 $.dialog.alert({title:"更新",content:"更新成功！"});	
					doSubmit();
				}
			}
		});
	});
	
	//编辑
	$(".editData").click(function(){
		var orderNo = $(this).attr("orderNo");
		$.ajax({
			url:"${pageContext.request.contextPath}/backend/order/orderByOrderNo?orderNo="+orderNo,
			type: 'POST',
			error: function(XMLHttpRequest, textStatus, errorThrown){
				 $.dialog.alert({title:"查看",content:"加载数据异常。"});
			},
			success: function(data){
				fillDIV(data);
			}
		});
		$("#editDIV").dialog("open");
	});
	
	$(".editDataDetail").click(function(){
		var orderNo = $(this).attr("orderNo");
		var orderType = $(this).attr("orderType");
		window.location.href = "${pageContext.request.contextPath}/backend/order/searchDetail?orderNo="+orderNo+"&orderType="+orderType; 
	});
	
	function fillDIV(data){
		$("#dealid").val(data.id);
		<c:forEach items="${beans}" var="o">
			$("#deal${o.filterField}").val(data.${o.field});
		</c:forEach>
	}
	
	var editDivHeight = 550;
	var editDivWidth = 450;
	var isEditDivHeight = typeof myEditDivHeight == "undefined";
	var isEditDivWidth = typeof myEditDivWidth == "undefined";
	
	$("#editDIV").dialog({
		autoOpen : false,
		bgiframe: true, 
		height : isEditDivHeight?editDivHeight:myEditDivHeight,
		width : isEditDivWidth?editDivWidth:myEditDivWidth,
		modal : true,
		resizable :false,
		hide: '',
		show:'',
		zIndex:1000,
		close : function() {
		}
	});
	
</script>
</body>
</html>